
include $(ACM_ROOT)/src/common_lib_macro.mk

LOCAL_CPPFLAGS = \
  $(COMMON_LIB_CPPFLAGS) \
  -I $(ACM_ROOT)/src/include \
  -I $(ACM_ROOT)/src/kernel/include \
  -I $(ACM_ROOT)/src/utils/include \
  -I $(ACM_ROOT)/src/log/include \
  -I $(ACM_ROOT)/src/poller/include \
  -I $(ACM_ROOT)/src/net/include \
	-I $(ACM_ROOT)/src/time/include \
  -I $(ACM_ROOT)/src/frwk/include  

LINK_FLAGS = -L$(LIBDIR) -lcl_common_cpp -lpthread 

vpath %.h ../include

BINS = test_mutex test_queues test_valueptr test_active_object \
			 test_timer_service test_servers test_client test_signal_hdlr \
			 test_thread_pool test_log test_chatserver 

all: $(BINS) 
.PHONY: all

CPP_SRC = \
  test_mutex.cpp \
  test_queues.cpp \
	test_valueptr.cpp \
	test_active_object.cpp \
	test_timer_service.cpp \
	test_servers.cpp \
	test_client.cpp \
	test_signal_hdlr.cpp \
	test_thread_pool.cpp \
	test_log.cpp \
	test_chatserver.cpp

CPP_OBJS = $(CPP_SRC:.cpp=.o)

test_mutex : test_mutex.o 
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_queues : test_queues.o 
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_valueptr : test_valueptr.o 
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_active_object : test_active_object.o 
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_timer_service : test_timer_service.o
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_servers: test_servers.o
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_client: test_client.o
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_signal_hdlr: test_signal_hdlr.o
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_thread_pool: test_thread_pool.o
	$(CCC) -o $@ $^ $(LINK_FLAGS)

test_log: test_log.o
	$(CCC) -o $@ $^ $(LINK_FLAGS) 

test_chatserver: test_chatserver.o
	$(CCC) -o $@ $^ $(LINK_FLAGS) 


.PHONY: clean
clean:
	$(RM) $(CPP_OBJS) $(BINS)

ifneq ($(MAKECMDGOALS),clean)
-include $(CPP_SRC:.cpp=.d)
endif
